<template>
  <div class="wrapper">
    <swiper :options="swiperOption" v-if="isLoad">
      <!-- 实现循环渲染轮播图 -->
      <swiper-slide v-for="item in list" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl" alt="">
      </swiper-slide>

      <div class="swiper-pagination"  slot="pagination"></div>

    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  computed: {
    isLoad () {
      return this.list.length
    }
  },
  data () {
    return {
      swiperOption: {
        loop: true,
        autoplay: 2000,
        pagination: '.swiper-pagination'
      }
    }
  }
}
</script>

<style scoped lang="less">
  .wrapper /deep/ .swiper-pagination-bullet-active{
    background-color: #fff;
  }
  .wrapper{
    background-color: #fff;
    width: 100%;
    height: 0;
    overflow: hidden;
    padding-bottom: 28%;
    .swiper-img{
      width: 100%;
    }
  }
</style>
